<html class="no-js"><head>
	<meta charset="utf-8">
	<title>保洁预约</title>
	<meta name="description" content="">
	<meta name="HandheldFriendly" content="True">
	<meta name="MobileOptimized" content="320">
	<meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui, user-scalable=no">
	<meta http-equiv="cleartype" content="on">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="/assets/base/cleaning/css/common.css?v={BEESCRM:$csstime}">
	<link rel="stylesheet" href="/assets/base/cleaning/css/index.css?v={BEESCRM:$csstime}">
	<link rel="stylesheet" href="/assets/base/cleaning/css/font.css?v={BEESCRM:$csstime}">
	<link rel="stylesheet" href="/assets/base/repair/js/sweetalert/lib/sweet-alert.css?v={BEESCRM:$csstime}">
	<script src="/assets/base/cleaning/js/jquery-2.1.0.min.js"></script>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script type="text/javascript">
    	wx.config({
			debug: false,
			appId: "{BEESCRM:$appid}",
			timestamp: "{BEESCRM:$timestamp}",
			nonceStr: "{BEESCRM:$noncestr}",
			signature: "{BEESCRM:$signature}",
			jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','hideOptionMenu'],
		});
    	wx.ready(function(){
    		wx.hideOptionMenu();
    	});
    </script>
</head>
<body>
<div class="wraper">

    <div class="load">
        <img class="load-bee" src="/assets/base/cleaning/images/load-bee.png">
        <p>蜂巢小蜜蜂正在卖命加载中……</p>
    </div>
    
	<div class="head clearfix">
		<a href="javascript:history.back();" class="iconfont icon-zuo pull-left"></a>
		<span class="head-name pull-left">保洁详情</span>
	</div>
	
	<empty name="data">
		<!--无记录-->
		<div class="none-list"><img src="/assets/base/cleaning/images/none-list.png"/></div>
	<else />
		<!--有记录-->
		<div class="express">
			<div class="logistics">
				<volist name="data" id="vo">
				
					<div class="logistics-list">
						<div class="log">
							<div class="block-space">
								<p class="margin-b">								
									<switch name="vo['status']">
										<case value="2">
											<span class="text-grey">[未同意] 保洁通知</span>
										</case>
										<case value="1">
											<span class="text-grey">[已同意] 保洁通知</span>
										</case>
										<default/>
										<case value="0">
											<span class="text-blue">保洁通知</span>
										</case>
									</switch>								
									<span class="pull-right">{BEESCRM:$vo.create_time|date='m/d',###}</span>
								</p>
								<p>保洁时间：{BEESCRM:$vo.worktime|date="Y-m-d",###} <eq name="vo.classes" value="1">下午班<else/>上午班</eq></p>
								<p>保洁确认：请在{BEESCRM:$vo.keyword3}前确认是否同意，不同意者请注明更改的保洁时间。</p>
							</div>
							<span class="circle"></span>
							
							<switch name="vo['status']">
								<case value="0">
									<div class="list-btn clearfix">
										<a href="javascript:;" class="btn not_agree" data-notice_id="{BEESCRM:$vo.notice_id}">不同意</a>
										<a href="javascript:;" class="btn btn-blue btn_agree" data-notice_id="{BEESCRM:$vo.notice_id}">同意</a>
									</div>
								</case>
								<case value="2">
									<div class="list-btn block-space">
										备注：{BEESCRM:$vo.content}
									</div>
								</case>
							</switch>
						</div>
					</div>			
				</volist>
			</div>
		</div>
	</empty>
	
	<input id="notice_id" type="hidden" value=""/>
	<input id="notice_ids" type="hidden" value=""/>
	<div class="pop-box" id="notAgree">
		<div class="main">
			<p>请注明你想预约的保洁时间：</p>
			<textarea id="feedback"></textarea>
			<div class="btn-box clearfix">
				<a href="javascript:;" class="btn white-btn pull-left cancel_btn">取消</a>
				<a href="javascript:;" class="btn pull-right submit_btn">提交</a>
			</div>
		</div>
	</div>

    <if condition="$account_id neq 10" >
        <div class="bottom-box">
            <p class="copyright">技术支持 青橄榄网络</p>
        </div>
    </if>
</div>
<script src="/assets/bower_components/sweetalert/lib/sweet-alert.min.js"></script>
<script src="/assets/base/cleaning/js/jq.utils.js"></script>
<script>
	var height = $(document).height();
	var bottombox_height = $('.bottom-box').outerHeight();
	$('.wraper').css("minHeight", height);
	$('.logistics').css("paddingBottom", bottombox_height);

	$(function(){
		var height = $(document).height();
		var height_head = $('.head').outerHeight();
		var contain_h = height - height_head;
		$('.logistics').css("minHeight",contain_h);
	});

	$(window).load(function(){
		$('.load').hide();
	});
	
	$(document).on('click', '.not_agree', function(){
		$('#notice_id').val($(this).data('notice_id'));
		$('#notAgree').show();
	});
	
	$(document).on('click', '.submit_btn', function(){
		var json={}, data={};
		data.feedback = $('#feedback').val().replace(/^\s+|\s+$/g,"");;
		if(!data.feedback){
			$.alert('error', '请填写您的反馈信息');return;
		}
		data.notice_id = $('#notice_id').val();
		data.agree = 2;
		json.method = "post",
		json.type = "json",
		json.data = data;
		json.url = "{BEESCRM::U('/base/cleaning/feedback',array('cleaning_id' => $cleaningId))}";
		$.getAjax(json, true, notAgreeRefresh, '');
	});
	
	$(document).on('click', '.cancel_btn', function(){
		$('#notice_id').val('');
		$('#notAgree').hide();
	});
	
	//发送消息
    $(document).on('click', '.btn_agree', function(){
    	var msg = '确认同意保洁时间安排？';
    	$('#notice_ids').val($(this).data('notice_id'));
    	$.confirm(msg, doSend);
    });
	
    function doSend(){		
		var json = {}, data = {};
		data.notice_id = $('#notice_ids').val(); 
		if(!data.notice_id){
			alert('(╯▔︹▔)╯请求参数错误，刷新试一下~');
			//$.alert('error', '(╯▔︹▔)╯请求参数错误，刷新试一下~');return false;
		}
		data.agree = 1;
		json.data = data;
		json.method = "post";
		json.url = "{BEESCRM::U('/base/cleaning/feedback',array('cleaning_id' => $cleaningId))}";
		$.getAjax(json, true, refresh, '');
	}
	
    function notAgreeRefresh(){
		$('#notAgree').hide();
		$('#notice_id').val('');
		setTimeout('location.reload()', 3000);
	}
    
	function refresh(){
		setTimeout('location.reload()', 3000);
	}
</script>
</body>
</html>